package wwy.Entity;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import jakarta.persistence.*;
import lombok.Getter;
import lombok.Setter;
import wwy.Common.orgEntity.LogicEntity;
import wwy.Entity.CommonEntity.User;

import java.util.Set;

@Getter
@Setter
@Entity
public class Orders extends LogicEntity {
    private String merchantName;
    private Double totalPrice;
    private String states;

    @OneToMany(mappedBy = "order",
            fetch = FetchType.LAZY,
            cascade = CascadeType.ALL)
    @JsonIgnoreProperties("order")
    private Set<OrderItem> orderItems;

    @ManyToOne(fetch = FetchType.LAZY)
    @JsonIgnoreProperties(value = {"orders"})
    private User user;

}
